#include "topcvt_common.hpp"
#include <time.h>

#include "pugixml/pugixml.hpp"

namespace topcvt
{
    void exit_system(int code)
    {
#ifdef WIN32	
        system("pause");
#endif		
        exit(code);
    }

    string xmlStatusInfo(int xmlParseStuts)
    {
        string xmlParseStatusInfo;
        switch (xmlParseStuts)
        {
        case pugi::status_file_not_found:
            xmlParseStatusInfo = "file_not_found";
            break;
        case pugi::status_io_error:
            xmlParseStatusInfo = "io_error";
            break;
        case pugi::status_out_of_memory:
            xmlParseStatusInfo = "out_of_memory";
            break;
        case pugi::status_internal_error:
            xmlParseStatusInfo = "internal_error";
            break;
        case pugi::status_unrecognized_tag:
            xmlParseStatusInfo = "unrecognized_tag";
            break;
        case pugi::status_bad_pi:
            xmlParseStatusInfo = "bad_pi:document declaration/processing instruction error";
            break;
        case pugi::status_bad_comment:
            xmlParseStatusInfo = "bad_comment";
            break;
        case pugi::status_bad_cdata:
            xmlParseStatusInfo = "bad_cdata";
            break;
        case pugi::status_bad_doctype:
            xmlParseStatusInfo = "bad_doctype:document type declaration error";
            break;
        case pugi::status_bad_pcdata:
            xmlParseStatusInfo = "bad_pcdata:PCDATA section error";
            break;
        case pugi::status_bad_start_element:
            xmlParseStatusInfo = "bad_start_elemen";
            break;
        case pugi::status_bad_attribute:
            xmlParseStatusInfo = "bad_attribute:element attribute error";
            break;
        case pugi::status_bad_end_element:
            xmlParseStatusInfo = "bad_end_element:end element tag error";
            break;
        case pugi::status_end_element_mismatch:
            xmlParseStatusInfo = "end_element_mismatch";
            break;
        case pugi::status_append_invalid_root:
            xmlParseStatusInfo = "append_invalid_root";
            break;
        case pugi::status_no_document_element:
            xmlParseStatusInfo = "no_document_element";
            break;
        default:
            xmlParseStatusInfo = "ok";
        }
        return xmlParseStatusInfo;
    }
};